fix(logging): combine newline-split stdout messages into one log entry#9757
fix(logging): combine newline-split stdout messages into one log entry#9757rishika0212 wants to merge 3 commits intoflutter:masterfrom
Conversation
srawlins
left a comment
There was a problem hiding this comment.
Just a preliminary review so we can kick off CI.
packages/devtools_app/lib/src/screens/logging/logging_controller.dart
Outdated
Show resolved
Hide resolved
packages/devtools_app/lib/src/screens/logging/logging_controller.dart
Outdated
Show resolved
Hide resolved
elliette
left a comment
There was a problem hiding this comment.
Hi @rishika0212 - do you mind adding before/after screenshots to the PR description for this change? Thank you!
Before (master): a single multiline log message using \n appears as two separate log entries (FIRST LINE and SECOND LINE).
After (this PR): the same multiline message appears as one log entry, with both lines shown together in Details.
|
packages/devtools_app/integration_test/test/live_connection/debugger_panel_test.dart
Outdated
Show resolved
Hide resolved
| final WidgetTester _tester; | ||
|
|
||
| Future<void> clear() async { | ||
| final controller = screenControllers.lookup<NetworkController>(); |
There was a problem hiding this comment.
Same question as above - why was this test changed?
There was a problem hiding this comment.
same reason
This change is now removed from this PR.
packages/devtools_app_shared/lib/src/service/eval_on_dart_library.dart
Outdated
Show resolved
Hide resolved
packages/devtools_shared/lib/src/test/integration_test_runner.dart
Outdated
Show resolved
Hide resolved
0383010 to
4a5b354
Compare


Fixes #9557
When
debugPrint('line1\nline2')is called, the VM sends the message as two separate stdout events:'line1\n'and'line2'. The existing 1ms buffer inStdoutEventHandleronly handled the case where the second event is a lone'\n'(e.g.foofollowed by\n). It did not handle embedded newlines, so each chunk became a separate log entryin the Logging screen.
The fix extends the buffer logic: if the buffered message ends with
'\n', the next incoming message is treated as a continuation of the same print statement and combined into a single log entry._StdoutEventHandlerwas also exposed asStdoutEventHandlerwith@visibleForTestingto allow direct unit testing of the handler logic.Before:
debugPrint('line1\nline2')appeared as two separate log entries.After: It appears as a single log entry.
Pre-launch Checklist
General checklist
///).Issues checklist
contributions-welcome] or [good-first-issue] label.contributions-welcome] or [good-first-issue] label. I understand this means my PR might take longer to be reviewed.Tests checklist
AI-tooling checklist
Feature-change checklist
release-notes-not-requiredlabel or left a comment requesting the label be added.packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md.